package sk.model;

public class PlayerData {

	private Player player;
	private boolean layed = false;
	private int injected = 0;
	private boolean virgin = false;

	public PlayerData(Player p) {
		player = p;
	}

	public PlayerData(String string) {
		String[] tokens = string.split("~");
		player = new Player(tokens[0]);
		int lay = Integer.parseInt(tokens[1]);
		int inj = Integer.parseInt(tokens[2]);
		int virg = Integer.parseInt(tokens[3]);
		layed = (lay == 1);
		injected = inj;
		virgin = (virg == 1);
	}

	@Override
	public String toString() {
		int lay = layed ? 1 : 0;
		int vir = virgin ? 1 : 0;
		return player.toString() + "~" + lay + "~" + injected + "~" + vir;
	}

	public boolean isVirgin() {
		return virgin;
	}

	public void setVirgin(boolean virgin) {
		this.virgin = virgin;
	}

	public Player getPlayer() {
		return player;
	}

	public void setLayed(boolean layed) {
		this.layed = layed;
	}

	public boolean isLayed() {
		return layed;
	}

	public void addInjection() {
		injected++;
	}

	public int getInjected() {
		return injected;
	}

}
